﻿#set($tmpType="")
#set($tmpDetext="")
#set($tmpPK="")
#set($tmpTypeName="")
#foreach($u in $TableInfos)
#beforeall 
#each  
#foreach($c in $u.ColumnInfos)  
#beforeall
#each 
#if($c.IsPK=="True") #set($tmpPK="$c.ColumnName")  #set($tmpTypeName="$c.TypeCSharpName") #set($tmpDetext="$c.DeText") #end
#afterall
#end  
        #region "$u.TabName ($u.TabCaption ) - Method"
        /// <summary>
        /// 新增/删除/修改 ${u.TabName}Entity ($u.TabCaption)
        /// </summary>
        /// <param name="fam">${u.TabName}Entity实体类</param>
        /// <returns>-1:存储过程执行失败,-2:存在相同的主键,Insert:返回插入自动ID,Update:返回更新记录数,Delete:返回删除记录数</returns>
        public static Int32 ${u.TabName}InsertUpdateDelete(${u.TabName}Entity fam)
        {
            return DALHelper.CMEHelper.${u.TabName}InsertUpdateDelete(fam);
        }
        /// <summary>
        /// 根据$tmpPK返回 ${u.TabName}Entity实体类 单笔资料 ($u.TabCaption)
        /// </summary>
        /// <param name="$tmpPK">$tmpPK $tmpDetext</param>
        /// <returns>返回 ${u.TabName}Entity实体类 $tmpPK为0则无记录</returns>
        public static ${u.TabName}Entity  ${u.TabName}Disp($tmpTypeName $tmpPK)
        {
            ${u.TabName}Entity fam = null;
            QueryParam qp = new QueryParam();
            qp.PageIndex = 1;
            qp.PageSize = 1;
            qp.Where = string.Format("{0}.{1} = {2}", "$u.TabName", "$tmpPK", $tmpPK);
            int RecordCount = 0;
            List<${u.TabName}Entity> lst = ${u.TabName}List(qp, out RecordCount);
            if (RecordCount > 0)
            {
                fam = lst[0];
            }
            return fam;
        }

        /// <summary>
        /// 返回${u.TabName}Entity实体类的List对象 ($u.TabCaption)
        /// </summary>
        /// <param name="qp">查询类(非安全函数,传入参数请进行Sql字符串过滤)</param>
        /// <param name="RecordCount">返回记录总数</param>
        /// <returns>${u.TabName}Entity实体类的List对象($u.TabCaption)</returns>
        public static List<${u.TabName}Entity> ${u.TabName}List(QueryParam qp, out int RecordCount)
        {
            qp.TableName = "$u.TabName";
            if (string.IsNullOrEmpty(qp.Orderfld))
            {
                qp.Orderfld = "$tmpPK desc";
            }
            if (string.IsNullOrEmpty(qp.ReturnFields))
            {
                qp.ReturnFields = "*";
            }
            if (string.IsNullOrEmpty(qp.NotInRowName))
            {
                qp.NotInRowName = "$tmpPK";
            }
            return DALHelper.CMEHelper.${u.TabName}List(qp,true, out RecordCount);
        }
        #endregion
#afterall
#nodata
暂无用户资料
#end 